// --------------------------------------------------------------------------------------------------------------------
// <copyright file="MockFloorFilterPruner.cs" company="Microsoft Corporation">
// The MIT License (MIT)
// 
// Copyright (c) 2014, Microsoft Corporation
// 
// Permission is hereby granted, free of charge, to any person obtaining a copy
//  of this software and associated documentation files (the "Software"), to deal
//  in the Software without restriction, including without limitation the rights
//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//  copies of the Software, and to permit persons to whom the Software is
//  furnished to do so, subject to the following conditions:
// 
// The above copyright notice and this permission notice shall be included in
//  all copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
//  THE SOFTWARE.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace Test.Robotics.Runtime
{
    using System;
    using System.Collections.Generic;
    using Microsoft.Robotics.Numerics;
    using Microsoft.Robotics.Vision.Cameras;
    using Microsoft.Robotics.Vision.Runtime.Cameras;    

    /// <summary>
    /// Mock Correction utility class for injecting into Kinect processor 
    /// </summary>
    public partial class MockFloorFilterPruner : IFlatSurfaceLearnDataPruner
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="MockFloorFilterPruner" /> class.
        /// </summary>
        public MockFloorFilterPruner() 
        { 
            this.DataPointsA = new List<FastTuple<double, double>>();
            this.DataPointsB = new List<FastTuple<double, double>>();
            this.DataPointsD = new List<FastTuple<double, double>>();
        }

        /// <summary>
        /// Gets or sets Data points A 
        /// </summary>
        public List<FastTuple<double, double>> DataPointsA { get; set; }

        /// <summary>
        /// Gets or sets Data points B
        /// </summary>
        public List<FastTuple<double, double>> DataPointsB { get; set; }

        /// <summary>
        /// Gets or sets Data points D
        /// </summary>
        public List<FastTuple<double, double>> DataPointsD { get; set; }

        /// <summary>
        /// Initializes an object with floor filtering calibration data
        /// </summary>
        /// <param name="calibrationData">An array initialized with pre-learned A and B coefficients in rows, per strip of floor (columns)</param>
        public void SetCalibrationData(double[][] calibrationData) 
        { 
        }

        /// <summary>
        /// Determines whether or not the pruner is initialized with pre-learned data
        /// </summary>
        /// <returns>Whether or not learn data has been set</returns>
        public bool IsInitialized() 
        {
            return true;
        }

        /// <summary>
        /// Clears all previous state and starts a new pruning session. For performance reasons we don't want to destroy 
        /// all objects that have been initialized first time pruner was ran, but we can easily remove all data from previous session
        /// </summary>
        /// <param name="frameHeight">Frame height.</param>
        /// <param name="frameWidth">Frame width. </param>
        /// <param name="stripCount">Number of strips</param>
        public void PrepareForNewPruningSession(int frameHeight, int frameWidth, int stripCount) 
        { 
        }

        /// <summary>
        /// Add sample to pruner
        /// </summary>
        /// <param name="stripCenter">Strip center coordinate</param>
        /// <param name="floorFitResult">Strip fit coefficients</param>
        /// <param name="averageStripDepth">Average depths</param>
        public void AddSample(
            int stripCenter,
            FastTuple<double, double, double> floorFitResult,
            double averageStripDepth) 
        { 
        }

        /// <summary>
        /// Prunes outlier coefficients. We apply a series of filters to make sure that what we learn is indeed floor
        /// and not just any surface
        /// </summary>
        public void PruneOutliers() 
        { 
        }

        /// <summary>
        /// Validates pruned strip data to make sure it makes sense as a whole (after pruning removes outliers)
        /// </summary>
        /// <returns>Whether or not the final A dataset of good for fitting a floor plane</returns>
        public bool IsLearnDataValid() 
        {
            return true;
        }

        /// <summary>
        /// Gets pruned A and B data points
        /// </summary>
        /// <param name="dataPointsA">Pruned A data points</param>
        /// <param name="dataPointsB">Pruned B data points</param>
        /// <param name="dataPointsD">Pruned D data points</param>
        public void GetPrunedDataPoints(out List<FastTuple<double, double>> dataPointsA, out List<FastTuple<double, double>> dataPointsB, out List<FastTuple<double, double>> dataPointsD) 
        {
            dataPointsA = this.DataPointsA;
            dataPointsB = this.DataPointsB;
            dataPointsD = this.DataPointsD;
        }
    }
}
